@extends('layout.adminlayout')
@section('css')
<script src="/admin/js/metisMenu.min.js"></script>
<script src="/admin/js/custom.js"></script>
<link href="/admin/css/custom.css" rel="stylesheet">
@endsection
@section('content')
<div class="tables">
	<div class="table-responsive bs-example widget-shadow">
		<h4 style="margin-bottom: 15px;">房间列表:</h4>
		<form action="/admin/room/index" method="get">
			<div class="row" style="padding-bottom: 15px;margin-top: 0px;">
				<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 70px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">代理商：</p>
				<select name="ag" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;">
					<option value="">请选择代理商</option>
					@foreach($agent as $v)
						<option value="{{$v['id']}}"
								@if($get['ag'] == $v['id'])
								selected
								@else
								@if(Cookie::get('agentId') == $v['id'])
								selected
								@endif
								@endif>{!! $v['agent_name'] !!}</option>
					@endforeach
				</select>
				<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 70px; height: 32px;padding: 0px;text-align: right;line-height: 32px;"> 房间：</p>
				<input type="text" name="room" value="{{$get['room']}}" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;"/>
				<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 70px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">区域：</p>						
				<input type="text" name="area" id="" value="{{$get['area']}}" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;"/>
				<p class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="width: 70px; height: 32px;padding: 0px;text-align: right;line-height: 32px;">建筑：</p>						
				<input type="text" name="building" id="" value="{{$get['building']}}" class="col-lg-1 col-md-1 col-sm-1 col-xs-1" style="height: 30px; line-height: 30px; padding: 0px; border: 1px solid #DDD; margin: 0px 10px; width: 15%;"/>
				<input type="submit" value="搜索" class="col-lg-1 col-md-1 col-sm-1 col-xs-1"  style="height: 30px; line-height: 32px; padding: 0px; border: 0; background: #4F52BA;width: 50px; margin: 0px 10px;color:#fff"/>	
			</div>
		</form>
		<table class="table table-bordered" >
			<thead>		
 				<tr>
					<th style="text-align: center">编号</th>
					<th style="text-align: center">房间名称</th>
					<th style="text-align: center">所属建筑</th>
					<th style="text-align: center">所属区域</th>
					<th style="text-align: center">所在楼层</th>
					<th style="text-align: center">负责人</th>
					@if($get['ag'] == Cookie::get('agentId') || Cookie::get('agentId') == 1)
					<th style="text-align: center">操作</th>
					@endif
				</tr>
			</thead>
			<tbody>
			@if(!null==$info)
				@foreach($info as $v)
					<tr> 
						<th scope="row" style="text-align: center">{{$v['r_id']}}</th>
						<td style="text-align: center">{{$v['r_name']}}</td>
						<td style="text-align: center">{{$v['b_name']}}</td>
						<td style="text-align: center">{{$v['a_name']}}</td>
						<td style="text-align: center">{{$v['r_floor']}}</td>
						<td style="text-align: center">{{$v['mma_username']}}</td>
						@if($get['ag'] == Cookie::get('agentId') || Cookie::get('agentId') == 1)
						<td style="text-align: center"><a href="/admin/room/edit?r_id={{$v['r_id']}}">编辑</a>&nbsp;|&nbsp;<a href="/admin/room/delete?id={{base64_encode($v['r_id'])}}">删除</a></td>
						@endif
					</tr>
				@endforeach
			@endif
			</tbody> 
		</table>
		@if(!null == $data)
			<div style="float:right;">
				{!! $data->appends($request)->render() !!}
			</div>
		@endif
	</div>
</div>
@endsection